package com.yunhe.authority.controller.company;

import com.yunhe.authority.domain.company.CompanySupportingInfo;
import com.yunhe.authority.service.company.CompanySupportingInfoService;
import com.yunhe.common.annotation.OperationRecord;
import com.yunhe.common.constant.SystemConsts;
import com.yunhe.common.model.ResultObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName: CompanySupportingInfoController
 * @Description: 企业配套信息Controller
 * @author: GongDaCheng
 * @Date: 10:16 2021/7/14
 */
@Api(value = "CompanySupportingInfo", description = "企业配套信息", tags = {"Model_CompanySupportingInfo"})
@RequestMapping("/companySupportingInfo")
@RestController
public class CompanySupportingInfoController {

    @Autowired
    CompanySupportingInfoService companySupportingInfoService;

    /**
     * @Description 保存企业配套信息
     * @Param Long companyId, CompanySupportingInfo companySupportingInfo
     * @Return
     * @Date 2021/7/14 10:41
     */
    @ApiOperation("保存企业配套信息")
    @RequestMapping(value = "/saveCSInfo", method = RequestMethod.POST)
    public ResponseEntity<ResultObject> saveCSInfo(@RequestParam(value = "companyId", required = true) Long companyId, @RequestBody CompanySupportingInfo companySupportingInfo){
        CompanySupportingInfo csInfo = companySupportingInfoService.save(companyId, companySupportingInfo);
        return new ResponseEntity<>(new ResultObject<>(csInfo), HttpStatus.OK);
    }

    @ApiOperation("根据企业id查询企业配套信息")
    @RequestMapping(value = "/getByCompanyId", method = RequestMethod.GET)
    public ResponseEntity<ResultObject> getByCompanyId(@RequestParam(value = "companyId", required = true) Long companyId){
        CompanySupportingInfo csInfo = companySupportingInfoService.getByCompanyId(companyId);
        return new ResponseEntity<>(new ResultObject<>(csInfo), HttpStatus.OK);
    }
}
